home *** CD-ROM | disk | FTP | other *** search
/ Exame Informatica 139 / Exame Informatica 139.iso / Revista / Flash / Uniform Server / diskw / plugins / Services / w2c1.pl < prev   
Encoding:
Text File  |  2005-02-22  |  2.6 KB  |  87 lines

  1. # The Uniform Server Service Install Tool
  2. # By The Uniform Server Development Team
  3. # Version 1.5
  4.  
  5. print "This script will install Uniform Server as a Windows service!\n";
  6.  
  7. #$pathc="C:/UniServerX.X";
  8. $pathc="c:/UniServerX.X";
  9.  
  10. #$skip=(" gif jpg bmp pcx tif zip gz rar tar cab ha exe com dll hlp xls doc pdf ps dbf png log MYD frm MYI pm so var ");
  11. $paterns="\/www|\/home|\/cgi-bin|\/usr|\/tmp|\/htpasswd|\/scgi-bin|\/plugins";
  12. $use=".conf|.cgi|.pl|.bat|.cnf|.ini|Config.pm";
  13.  
  14. mkdir ("$pathc");
  15.  
  16. convert ("../../","$pathc");
  17. #coppy ("./files/Uninstall.bat", "$pathc/Uninstall.bat");
  18. convert ("./files","$pathc");
  19. coppy ("../../home/admin/www/redirect.html", "$pathc/redirect.html");
  20. #coppy ("./files/index.html","$pathc/home/admin/www/index.html");
  21. coppy ("$pathc/usr/local/PHP/php.ini", "$pathc/usr/local/Apache2/bin/php.ini");
  22. coppy ("$pathc/usr/local/PHP/libmysql.dll", "$pathc/usr/local/Apache2/bin/libmysql.dll");
  23. coppy ("$pathc/usr/local/mysql/bin/my-small.cnf", "c:/my.cnf");
  24. print "Installing Apache2 as service ...";
  25. $res=`$pathc/usr/local/apache2/bin/Apache.exe -f $pathc/usr/local/apache2/conf/httpd.conf -d $pathc/usr/local/apache2/. -k install -n "Apache2"`;
  26. print " done!\n";
  27. print "Installing MySQL as service ...";
  28. $res=`$pathc/usr/local/mysql/bin/mysqld-opt.exe  --install`;
  29. print " done!\n";
  30. print "Starting Apache2 ...";
  31. #$res=`$pathc/USR/LOCAL/APACHE2/BIN/APACHE.EXE -n Apache2 -k start`;
  32. $res=`net start Apache2`;
  33. print " done!\n";
  34. print "starting MySQL ...";
  35. $res=`net start mysql`;
  36. print " done!\n";
  37. print "Have a fun\n";
  38.  
  39. $res=`start $pathc/home/admin/www/redirect.html`;
  40.  
  41. exit;
  42.  
  43. # usage convert (path,path1);
  44. sub convert {
  45.  my @names;
  46.  my $name;
  47.  my ($path)=$_[0] ;
  48.  my ($path1)=$_[1] ;
  49.  opendir DIR,"$path";
  50.  $name=readdir DIR;
  51.  $name=readdir DIR;
  52.  
  53.  @names=readdir DIR;
  54.  closedir DIR;
  55.  foreach $name (@names){
  56.   if (-d "$path/$name"){mkdir ("$path1/$name"); convert ("$path/$name","$path1/$name")};
  57.   if (!(-d "$path/$name")&&($name=~ /($use)$/)){
  58.    print "$path/$name - converting ...";
  59.    open (FILE,"$path/$name");
  60.    binmode FILE;
  61.    read FILE,$lines,100000;
  62.    close (FILE);
  63.    $lines=~ s/(\W)($paterns)/$1$pathc$2/g;
  64.    open (FILE,">$path1/$name");
  65.    binmode FILE;
  66.    print FILE $lines;
  67.    close (FILE);
  68.    print " done!\n";
  69.    } else {
  70.    print "$path/$name - transferring ...";
  71.    coppy ("$path/$name", "$path1/$name");
  72.    print " done!\n";
  73.    }
  74.   }
  75.  }
  76.  
  77. sub coppy {
  78.    open (FILE,"$_[0]");
  79.    binmode FILE;
  80.    @lines=<FILE>;
  81.    close (FILE);
  82.    open (FILE,">$_[1]");
  83.    binmode FILE;
  84.    print FILE @lines;
  85.    close (FILE);
  86. }
  87.